package com.eastfair.auth.api;

import com.eastfair.auth.dto.*;
import com.eastfair.auth.entity.Organization;
import com.eastfair.auth.entity.Role;
import com.eastfair.auth.entity.UserOrganization;
import com.eastfair.auth.hystrix.AuthApiFallback;
import com.eastfair.auth.hystrix.RoleApiFallback;
import com.eastfair.auth.vo.ResourceOrganizationVo;
import com.eastfair.auth.vo.RoleVo;
import com.eastfair.core.base.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * auth feign接口
 *
 * @Author ligang
 * @Date 2021/7/16 16:41
 */
@FeignClient(name = "auth/role", fallback = RoleApiFallback.class)
public interface RoleServiceFeign {

    /**
     * 批量查询角色信息
     * @param ids 菜单id
     * @return 查询结果
     */
    @ApiOperation(value = "批量查询角色信息", notes = "批量查询角色信息")
    @PostMapping("/findAllByIds")
    R<List<RoleVo>> findAllByIds(@RequestBody List<Long> ids);

    /**
     * 查询角色
     * @return 查询结果
     */
    @ApiOperation(value = "查询角色", notes = "查询角色")
    @PostMapping("/queryRole")
    R<List<RoleVo>> queryRole(@RequestBody RoleDTO roleDTO);

    /**
     * 创建角色
     * @param roleDTO 角色新增实体
     * @return
     */
    @ApiOperation(value = "创建角色", notes = "创建角色")
    @PostMapping("/createRole")
    R<Role> createRole(@RequestBody @Validated({RoleDTO.createRole.class}) RoleDTO roleDTO);
}
